import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { Https } from '../../app/http.service'
/**
 * Generated class for the ZhuanmaiDetailPage page.
 *
 * See https://ionicframework.com/docs/components/#navigation for more info on
 * Ionic pages and navigation.
 */

@IonicPage()
@Component({
  selector: 'page-zhuanmai-detail',
  templateUrl: 'zhuanmai-detail.html',
})
export class ZhuanmaiDetailPage {
	//0 折叠 1 展开
	fold:number = 0;
	ajaxUrl = new Https().Url + "act=goods&op=app_zhuanmai_detail";
	Id:string
	Data=[];
	constructor(public navCtrl: NavController, public navParams: NavParams) {
		this.Id = this.navParams.get("id");
		//
		this.getData()
	}

	ionViewDidLoad() {
		console.log('ionViewDidLoad ZhuanmaiDetailPage');
		
	}
	getData(){
		let then = this
		fetch(this.ajaxUrl, {
			method: "post",
			headers: {
				'Content-Type': 'application/x-www-form-urlencoded'
			},
			body: "mid=" + localStorage.getItem("mid") + "&token=" + localStorage.getItem("token") +"&id=" +this.Id,
		}).then((response) => {
			response.text().then((con) => {
				let resource = JSON.parse(con).datas
				then.Data = resource
				// console.log(con)
			})
		}).catch((err) => {
		})
	}
	codeFold(num){
		console.log(num)
		this.fold = this.fold == 0 ? 1: 0
	}
}
